<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>


    <script>
        function gitRandom(n, m) {
            return Math.floor(Math.random() * (m - n + 1)) + 1

        }

        let re1 = gitRandom(1, 10)
        while (true) {
            let num = +prompt('请输入一个数字')
            if (num > re1) {
                alert('大了')
            }

            if (num < re1) {
                alert('小了')
            }

            if (num === re1) {
                alert('对了')
                break
            }
            console.log(re1);

        }

    </script>
</body>

</html>